/**
 * 〈功能简述〉<br>
 * 〈〉
 *
 * @author LiJunYi
 * @create 2019/7/5
 * @since 1.0.0
 */
package com.ljy.system.marvel_sys.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ljy.system.marvel_sys.system.dao.RoleDao;
import com.ljy.system.marvel_sys.system.model.role.Role;
import com.ljy.system.marvel_sys.system.service.IRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class RoleServiceImpl implements IRoleService {

    @Resource
    RoleDao roleDao;

    @Override
    public List<Role> listRoles() {
        return roleDao.selectList(null);
    }

    @Override
    public IPage<Role> pageRoles(int limit, int pages) {
        Page<Role> page = new Page<>(pages,limit,true);
        IPage<Role> roles = roleDao.selectPage(page, new QueryWrapper<Role>().orderByDesc("id"));
        return roles;
    }
}
